<?php
/* @var $this SuratKeluarController */
/* @var $model SuratKeluar */

$this->breadcrumbs=array(
	'Surat Keluar'
);


Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('surat-keluar-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>

<?php $this->widget('ext.widgets.grid.AxGridView', array(
	'id'=>'surat-keluar-grid',
	'dataProvider'=>$model->search(),
	//'filter'=>$model,
	'columns'=>array(
		array(
                    'name' => 'tanggal_pembuatan',
                    'value' => 'date("Y-M-d H:i", strtotime($data->tanggal_pembuatan))'
                ),
                'no_surat',
		'judul_surat',
                array(
                  'name' => 'Pegawai.nama',
                  'header' => 'Dibuat Oleh'
                ),
                array(
                    'header' => 'Draft',
                    'value' => '($data->draft==1)? "Draft" : "Publish" '
                ),
                array(
                    'header' => 'Status',
                    'value' => '$data->ApprovalStatus'
                ),
		array(
			'class'=>'CButtonColumn',
                        'template'=> '{print} {update} {view} {delete}',
                        'buttons'=> array(
                            'print' => array(
                                'url'=> 'Yii::app()->createUrl("/SuratKeluar/Preview/".$data->id_surat_keluar)',       // a PHP expression for generating the URL of the button
                                'imageUrl'=>'/images/icon/print.png',  
                                'visible'=>'$data->ApprovalStatus  == "Telah disetujui"',
                              )
                        ),
                        'headerHtmlOptions' => array('class' => 'lastcolumn'),
                        'htmlOptions' => array('class' => 'lastcolumn')
		),
	),
)); ?>